<% layout('/layouts/default.html', {title: '任务部署信息表(主)管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<#form:form id="searchForm" model="${dcSupTaskAction}" action="${ctx}/action/dcSupTaskAction/listData" method="post" class="form-inline"
			data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
<!--			<#form:hidden path="messageNumber"/>-->
<!--			<#form:hidden path="taskId" />-->
<!--			<#form:hidden path="taskProgress" />-->
<!--			<#form:hidden path="taskLeader" />-->
<!--			<#form:hidden path="timeParam" value="${dcSupTaskAction.timeParam!}" />-->
			<#form:hidden path="messageNumber"/>
			<#form:hidden path="taskYear"/>
			<#form:hidden path="taskTitle"/>
			<#form:hidden path="taskTypeCode"/>
			<#form:hidden path="taskId"/>
		</#form:form>
	</div>
	<div class="box-body">
		<table id="dataGrid"></table>
		<div id="dataGridPage"></div>
	</div>
</div>
</div>
<% } %>
<script>
	//重置
	function cz(){
		searchForm.reset();
		$('#dataGrid').dataGrid('reloadGrid');
	}

	// 初始化DataGrid对象
	$('#dataGrid').dataGrid({
		searchForm: $("#searchForm"),
		sortableColumn: false, // 列表不允许排序
		columnModel: [
			{header:'${text("主键")}', name:'id', index:'a.id', width:150, align:"left", hidden:true},
			{header:'${text("督办字号")}', name:'messageNumber', index:'a.message_number', width:100, align:"left"},
			{header:'${text("任务标题")}', name:'taskTitle', index:'a.task_title', width:150, align:"left"},
			{header:'${text("任务类型")}', name:'taskTypeName', index:'a.task_type_name', width:150, align:"left"},
			{header:'${text("任务内容")}', name:'taskContent', index:'a.task_content', width:150, align:"left"
				, formatter: function(val, obj, row, act){
					return '<a href="${ctx}/taskdeploy/dcSupTaskInfo/detailForm?id='+row.taskId+'" class="btnList" data-title="${text("督办任务信息")}">'+(val||'暂无内容')+'</a>';
				}
			},
			{header:'${text("牵头领导")}', name:'taskLeaderName', index:'a.task_leader_name', width:150, align:"left"},
			{header:'${text("牵头责任单位")}', name:'leaderOrgName', index:'a.leader_org_name', width:150, align:"left"},
			{header:'${text("任务完成进度")}', name:'taskProgress', index:'a.task_progress', width:150, align:"center"
				,formatter: function(val, obj, row, act){

					return js.getDictLabel(${@DictUtils.getDictListJson('dc_task_progress')}, val, '${text("未知")}', true);
				}},
			{header:'${text("任务状态")}', name:'taskStatus', index:'a.task_status', width:150, align:"center"
				,formatter: function(val, obj, row, act){
					return js.getDictLabel(${@DictUtils.getDictListJson('dc_task_action_status')}, val, '${text("未知")}', true);
				}},
			{header:'${text("操作")}', name:'actions', align:"center",width:250, formatter: function(val, obj, row, act){
					var actions = [];
					/*	actions.push('<a href="${ctx}/action/dcSupTaskAction/form?id='+row.id+'" class="btn btn-primary btn-xs" title="${text("查看")}">查看</a>&nbsp;');*/
					actions.push('<a  href="${ctx}/audit/taskReceive/taskReceiveFive?remarks2=0&isNewRecord=false&id=' + row.id + '&taskId=' + row.taskId + '" class="btn btn-primary btn-xs btnList" title="${text("反馈记录")}"><span>反馈记录</span></a>&nbsp;&nbsp;&nbsp;');
					actions.push('<a style="cursor:pointer;" onclick=addFeedback("' + row.id + '") class="btn btn-primary btn-xs" title="${text("增加反馈")}" ><span>增加反馈</span></a>&nbsp;');
					if('${dcSupTaskAction.remarks1}'==1){
						actions.push('<a style="cursor:pointer;" onclick=cuiban("' + row.id + '") class="btn btn-primary btn-xs" title="${text("催办")}" ><span>催办</span></a>&nbsp;');
					}
					return actions.join('');
				}}
		],
		// 加载成功后执行事件
		ajaxSuccess: function(data){

		}
	});

	function showSubTask(id) {
		js.addTabPage(null, "子任务明细","${ctx}/action/dcSupTaskAction/listOrg?taskId="+id , true);
	}

	function editTask(id) {
		js.addTabPage(null, "编辑督办任务","${ctx}/taskdeploy/dcSupTaskInfo/form?id="+id , true);
	}

	function arrangeHis(id) {
		js.addTabPage(null, "整理历史","${ctx}/arrange/dcSupTaskInfoArrange?taskId="+id , true);
	}
	function arrangeTask(taskId){
		js.layer.open({
			type: 2,
			title: ['整理任务'],
			area: ['1000px', '460px'],
			scrollbar: true,
			shadeClose: false,
			content: "${ctx}/taskdeploy/dcSupTaskInfo/arrangeTask?taskId="+taskId,
			btn1: function (index, layero) {
			},
			end:function () {
				$('#dataGrid').dataGrid('refresh', 1, 20);
			}
		});
	}
	function returnHtml (){
		var messageNumber =encodeURIComponent($("#messageNumber").val());
		var taskTitle =encodeURIComponent($("#taskTitle").val());
		$("#ret").attr("href","${ctx}/taskdeploy/dcSupTaskInfoSecretary/messageNumberListed?messageNumber="+messageNumber+"&taskYear="+$("#taskYear").val()+"&taskTitle="+taskTitle+"&taskTypeCode="+$("#taskTypeCode").val());
	}

	function cuiban(id){
		js.loading();
		js.layer.open({
			type: 2,
			title: ['催办'],
			area: ['800px', '400px'],
			scrollbar: true,
			shadeClose: false,
			content: "${ctx}/home/supIndex/cuibanPage?id="+id,
			btn1: function (index, layero) {
			},
			success: function (data) {
				js.closeLoading(0, true);
			},
			end:function () {

			}
		});
		// js.loading("正在催办...");
		// $.ajax({
		// 	url: "${ctx}/home/supIndex/cuiban",
		// 	type: "post",
		// 	data: {
		// 		"id":id
		// 	},
		// 	success: function(data){
		// 		js.closeLoading(0, true);
		// 		js.showMessage(data.message);
		// 	},
		// 	error: function(data){
		// 		js.closeLoading(0, true);
		// 		js.showErrorMessage(data.responseJSON.message+"，请联系管理员");
		// 	}
		// });
	}

	function addFeedback(id) {
		js.loading();
		js.layer.open({
			type: 2,
			title: ['增加反馈'],
			area: ['800px', '400px'],
			scrollbar: true,
			shadeClose: false,
			content: "${ctx}/feedback/dcSupTaskFeedback/addFeedback?actionId=" + id,
			btn1: function (index, layero) {
			},
			success: function (data) {
				js.closeLoading(0, true);
			},
			end: function () {

			}
		});
	}
</script>